package com.example.design.c.command;

import lombok.Getter;
import lombok.Setter;

/**
 * 具体命令
 */
@Setter
@Getter
public class BeijiangRestaurant implements CallFoodCommand {

    /**
     * 接收者
     * 厨房实例对象
     */
    private KitchenReceiver receiver;

    /**
     * 构造方法
     * 实例化厨房对象
     *
     * @param receiver
     */
    public BeijiangRestaurant(KitchenReceiver receiver) {
        this.receiver = receiver;
    }

    /**
     * 具体命令执行逻辑
     * 点菜
     */
    @Override
    public void execute(int[] foodList) {
        if (receiver == null) {
            System.out.println("没厨房做什么菜..!");
            return;
        }
        System.out.println("执行点菜的具体命令");
        if (foodList == null) {
            System.out.println("菜品列表为空, 命令终止");
            return;
        }
        receiver.action(foodList);
    }
}
